<?php
	include('config.php');
	
	$hash 	= $_GET['pw'];
	$name = $_GET['name'];

	mysql_connect($host,$username,$password);
	mysql_select_db($database);

	$myUser = mysql_query("SELECT * FROM saufanten WHERE name = '".$name."'"); // ausführen des selects und speichern in ein resultset
	$myUser = mysql_fetch_array($myUser);
	
	if( $myUser['passHASH'] == $hash ) {
		session_start();
		$_SESSION['angemeldet'] = true;
		$_SESSION['AUTH_LEVEL'] = $myUser['rechte'];
		$_SESSION['Admin'] = $myUser['name'];
	    echo('done');
	} else{
		echo('fail');
	}
?>